package timbap.visualizer.api.context.textures;

import processing.core.PImage;
import timbap.visualizer.api.model.PlaylistEntry;
import timbap.visualizer.api.model.ArtworkData;

/**
 * The <code>TextureCacheManager</code> is responsible for
 * organizing the cache of artwork textures and providing
 * access to them.
 *
 * @author  Andreas Pabst
 */
public interface TextureCacheManager {

	/**
	 * gets the artwork texture of a specified playlist entry in an asynchronous manner
     * if the asynchronous loading is not yet done, a default texture is returned
	 * 
	 * @param pPlaylistEntry	the playlist entry to get the artwork texture for
	 * @return the artwork texture or a default texture
	 */
	public PImage getArtworkTextureAsync(PlaylistEntry pPlaylistEntry);

    /**
     * gets the artwork texture of a specified playlist entry synchronously
     * the thread will be blocked until the asynchronous loading is done
     *
     * @param pPlaylistEntry	the playlist entry to get the artwork texture for
     * @return the artwork texture
     */
    public PImage getArtworkTextureInSync(PlaylistEntry pPlaylistEntry);

    /**
	 * gets the raw compressed artwork data of a specified playlist entry
	 *
	 * @param pPlaylistEntry	the playlist entry to get the artwork texture for
	 * @return the artwork data
	 */
    public ArtworkData getArtworkData(PlaylistEntry pPlaylistEntry);

    /**
	 * performs the initial fill of the texture cache
	 */
	public void fillInitialTextureCache();

}
